package com.common.exception;

import com.common.exception.enums.ConstantExceptionEnums;

/**
 * 基础异常类
 */
public class ServiceException extends RuntimeException {
    private static final long serialVersionUID = -3030344392591938285L;

    private int code;
    private String msg;

    public ServiceException() {
    }

    public ServiceException(ConstantExceptionEnums constantExceptionEnums) {
        this.code = constantExceptionEnums.getCode();
        this.msg = constantExceptionEnums.getMessage();
    }

    public ServiceException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
